<!DOCTYPE html>
<html>
<head>
    <title>商品列表</title>
    <#include "/header.html">
    <link type="text/css" rel="stylesheet" href="${request.contextPath}/statics/plugins/layui/css/layui.css">
    <style>
        th {
            text-align: center;
        }

        .form-control {
            margin-left: 5px;
        }
        a {
            color: #2691FF;
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <form class="form-inline">
                <div class="form-group ">
                    <select v-model="q.terminalType"  class=" form-control">
                        <option v-for="ter in this.terminalTypes" :value="ter.terminalType">{{ter.terminalName}}</option>
                    </select>
                    <select v-model="q.goodsType" class=" form-control">
                        <option value="0">请选择商品类别</option>
                        <option value="1">终端</option>
                        <option value="2">物料</option>
                    </select>
                    <input type="button" class="btn btn-default form-control" @click="query"  value="查询"/>
                    <input type="button" class="btn btn-default form-control" @click="clean" value="刷新"/>
                    <input type="button" class="btn btn-default form-control" @click="add" value="添加"/>
                    <input type="button" class="btn btn-default form-control" @click="toUpdate" value="修改"/>
                </div>
            </form>

            <!--<#if shiro.hasPermission("sys:agent:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>-->
            <!--<#if shiro.hasPermission("sys:agent:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            </#if>
            <#if shiro.hasPermission("sys:user:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            </#if>-->
        </div>
        <table id="jqGrid"></table>

        <div id="jqGridPager"></div>
    </div>

    <div v-show="showBanner">
        <div class="grid-btn">
            <form class="form-inline">
                <div class="form-group ">
                    <input type="reset" class="btn btn-default form-control" @click="clean" value="返回"/>
                </div>
            </form>

            <!--<#if shiro.hasPermission("sys:agent:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>-->
            <!--<#if shiro.hasPermission("sys:agent:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            </#if>
            <#if shiro.hasPermission("sys:user:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            </#if>-->
        </div>
        <table id="bannerList"></table>

        <div id="bannerListPager"></div>
    </div>


    <div v-show="showAdd" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal addgoods" enctype="multipart/form-data">
            <div class="form-group">
                <div class="col-sm-2 control-label">商品名称</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="name"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">价格</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="price"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">最少数量</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="leastNum"/>
                </div>
            </div>
           <div class="form-group">
                <div class="col-sm-2 control-label">详情图片</div>
                <div class="col-sm-10">
                    <input type="file" class="form-control" name="infoImg"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">封面图片</div>
                <div class="col-sm-10">
                    <input type="file" class="form-control" name="coverImg"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">商品类别</div>
                <div class="col-sm-10">
                    <select name="goodsType" class="form-control">
                        <option value="0">请选择</option>
                        <option value="1">终端</option>
                        <option value="2">物料</option>
                    </select>
                </div>
            </div>
            <div class="form-group terminalType">
                <div class="col-sm-2 control-label">机具类别</div>
                <div class="col-sm-10">
                    <select v-model="initial.terminalType" name="terminalType" class="form-control">
                        <option v-for="ter in this.terminalTypes" :value="ter.terminalType">{{ter.terminalName}}</option>
                    </select>
                </div>
            </div>

            <div class="form-group model">
                <div class="col-sm-2 control-label">机具型号</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="model"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary " @click="addgoods" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>


    <div v-show="showUpdate" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal updateGoods" enctype="multipart/form-data">
            <input type="hidden" class="form-control" name="goodsId" v-model="goods.goodsId"/>
            <div class="form-group">
                <div class="col-sm-2 control-label">商品名称</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="name" v-model="goods.name"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">价格</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="price" v-model="goods.price"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">最少数量</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="leastNum" v-model="goods.leastNum"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">详情图片</div>
                <div class="col-sm-10">
                    <input type="file" class="form-control" name="infoImg"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">封面图片</div>
                <div class="col-sm-10">
                    <input type="file" class="form-control" name="coverImg"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">商品类别</div>
                <div class="col-sm-10">
                    <select name="goodsType" class="form-control" v-model="goods.goodsType">
                        <option value="1">终端</option>
                        <option value="2">物料</option>
                    </select>
                </div>
            </div>
            <div class="form-group terminalType">
                <div class="col-sm-2 control-label">机具类别</div>
                <div class="col-sm-10">
                    <select v-model="goods.terminalType" name="terminalType" class="form-control">
                        <option v-for="ter in this.terminalTypes" :value="ter.terminalType">{{ter.terminalName}}</option>
                    </select>
                </div>
            </div>
            <div class="form-group model">
                <div class="col-sm-2 control-label">机具型号</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="model" v-model="goods.model"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">商品顺序</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="sort" v-model="goods.sort"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">是否上架</div>
                <div class="col-sm-10">
                    <input type="radio"  name="isShow" v-model="goods.isShow" value="1"/>是
                    <input type="radio"  name="isShow" v-model="goods.isShow" value="2"/>否
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary " @click="update" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>


    <div v-show="addBanner" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal addBanner">
            <div class="form-group">
                <div class="col-sm-2 control-label">商品id</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="goodsId" readonly/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">轮播图(可多选)</div>
                <div class="col-sm-10">
                    <input type="file" id="file" class="form-control" @change="addfile('hello!', $event)" placeholder="添加轮播图" name="file" multiple/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="insertBanner" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>


    <div v-show="updateBanner" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal updateBanner" enctype="multipart/form-data">
            <div class="form-group">
                <div class="col-sm-2 control-label">商品id</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="goodsBannerId" name="goodsBannerId" v-model="banner.goodsBannerId" readonly="readonly"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">选择图片</div>
                <div class="col-sm-10">
                    <input type="file" class="form-control" name="file" />
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">图片预览</div>
                <div class="col-sm-10">
                    <img :src="banner.bannerImg">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">顺序</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="sort" v-model="banner.sort"/>
                </div>
            </div>-->
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary " @click="commitUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/goods/goodlist.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/plugins/layui/layui.js"></script>

</body>
<img src="" width="720px" height="auto" style="display: none;" id="goodsImg">
<div class="layui-carousel" id="goodBanner" style="display: none;width: 1125px;height: 630px">
    <div carousel-item id="bannerContent">
        <div></div>
    </div>
</div>

</html>